<style>
    .form-group label{width:85px}
</style>
<section class="content" >
    <div class="row">
        <div class="col-md-12">
            <div class="box box-danger">
                <div class="box-body">
                    <form id="site_public_editinfo_form">
                        <input type="hidden" name="id" value="{$info.id}" />
                        <div class="form-group">
                            <label style="display:inline-table">手机
                                <i class="fa fa-pencil-square-o"></i>:</label>
                            <input type="text" placeholder="请输入手机号码" 
                                   class="form-control"  data-validation="length"
                                   data-validation-length="min1"
                                   name="mobile" value="{$info.mobile}"
                                   data-validation-error-msg="请输入正确手机号码"
                                   style="display:inline;width: 70%">
                        </div>
                        <div class="form-group">
                            <label style="display:inline-table">登录密码
                                <i class="fa fa-pencil-square-o"></i>:</label>
                            <input type="text" placeholder="请输入登录密码"
                                   class="form-control"
                                   name="password"
                                   style="display:inline;width: 70%">
                        </div>
                        <div class="form-group">
                            <label style="display:inline-table">车量类型
                                <i class="fa fa-pencil-square-o"></i>:</label>
                            <label>
                                <input type="radio" value="0" name="type"
                                <eq name="info['type']" value="0"> checked="checked"</eq>
                                >&nbsp;&nbsp;内部车
                            </label>
                            <label>
                                <input type="radio" value="1" name="type"
                                <eq name="info['type']" value="1"> checked="checked"</eq>
                                >&nbsp;&nbsp;外部车
                            </label>
                        </div>
                        <div class="form-group">
                            <label style="display:inline-table">方量
                                <i class="fa fa-pencil-square-o"></i>:</label>
                            <foreach name="carType" item="vo">
                                <input type="radio" value="{$vo}" name="load"  <eq name="info['load']" value="$vo"> checked="checked"</eq>>&nbsp;&nbsp;{$vo}方
                            </foreach>
                        </div>
                        <div class="form-group">
                            <label style="display:inline-table">车号
                                <i class="fa fa-pencil-square-o"></i>:</label>
                            <input type="text" placeholder="请输入车号"
                                   class="form-control"
                                   name="carno" value="{$info.carno}"
                                   style="display:inline;width: 70%">
                        </div>
                        <div class="form-group">
                            <label style="display:inline-table">车队长
                                <i class="fa fa-pencil-square-o"></i>:</label>
                            <select class="select2 " name="captain" style="width: 60%">
                                <option value="0" >选择车队长</option>
                                <foreach name="captain" item="v">
                                  <option value="{$v.id}" <eq name="info['captain']" value="$v['id']"> selected</eq> >{$v.name}</option>
                                </foreach>
                              
                            </select>
                        </div>
                        <div class="form-group">
                            <label style="display:inline-table">联系人
                                <i class="fa fa-pencil-square-o"></i>:</label>
                            <input type="text" placeholder="请输入联系人"
                                   class="form-control"  data-validation="length"
                                   data-validation-length="min1"
                                   name="name" value="{$info.name}"
                                   data-validation-error-msg="请输入联系人"
                                   style="display:inline;width: 70%">
                        </div>
                        <div class="form-group">
                            <label style="display:inline-table">状态
                                <i class="fa fa-pencil-square-o"></i>:</label>
                            <label>
                                <input type="radio" value="0" name="status"
                                <eq name="info['status']" value="0"> checked="checked"</eq>
                                <eq name="info['status']" value=""> checked="checked"</eq>
                                >&nbsp;&nbsp;启用
                            </label>
                            <label>
                                <input type="radio" value="1" name="status"
                                <eq name="info['status']" value="1"> checked="checked"</eq>
                                >&nbsp;&nbsp;停用
                            </label>
                        </div>
                        <if condition="$roleid eq 1">
                        <div class="form-group">
                            <label style="display:inline-table">站点
                                <i class="fa fa-pencil-square-o"></i>:</label>
                            <select class="select2 " name="site" style="width: 60%">
                                <option value="0" <eq name="info['site']" value="0"> selected</eq> >无站点</option>
                                <foreach name="sites" item="site">
                                     <option value="{$site['id']}" <eq name="info['site']" value="$site['id']"> selected</eq> >{$site['name']}</option>
                                </foreach>
                            </select>
                        </div>
                        </if>
                        <div class="box-footer">
                            <span class="input-group-btn">
                                <button class="btn btn-danger pull-left" type="button"  id="close-dialog">取消</button>
                                <button class="btn btn-primary pull-right" type="button" id='site_public_editinfo_form_submit'>提交</button>
                            </span>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        $(function () {
            $(".select2").select2({minimumResultsForSearch: -1});
            $('#site_public_editinfo_form_submit').click(function () {
                $('#site_public_editinfo_form').submit();
            });
            $.validate({
                onSuccess: function () {
                    publicEditinfoFormSubmit();
                    return false;
                }
            });
        });

        function publicEditinfoFormSubmit() {
            $.post("{:U('Car/add')}",
                    $("#site_public_editinfo_form").serialize(), function (res) {
                if (!res.status) {
                    $.messager.alert('提示信息', res.info, 'error');
                } else {
                    $.messager.alert('提示信息', res.info, 'info');
                    dialog.get('dialogPage').close().remove();
                    reloadContent();
                }
            });
            return false;
        }

    </script>
</section>